package com.zzh.myapplication.activity;

import android.content.Intent;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import net.icarplus.car.R;
import net.icarplus.car.adapter.MicroEnergyAdapager;
import net.icarplus.car.bean.MicroEnergyBean;
import net.icarplus.car.manager.BaseActivity;
import net.icarplus.car.tools.ToolBarHelper;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/3/25.
 */
public class MicroEnergyActivity extends BaseActivity {
    private ListView list_item_micro_energy;
    private MicroEnergyAdapager adapager;
    private List<MicroEnergyBean> beans_list;
    private Toolbar toolbar;
    private TextView micro_setting;
    private Button btn_add;

    @Override
    public void setContent() {
        setContentView(R.layout.activity_micro_energy);
    }

    @Override
    public void initComponent() {
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        ToolBarHelper.setNormalTitleAndBack(this, toolbar, getString(R.string.my));
        micro_setting = (TextView) findViewById(R.id.micro_setting);
        list_item_micro_energy = (ListView) findViewById(R.id.list_item_micro_energy);
        btn_add = (Button) findViewById(R.id.btn_add);
        beans_list = new ArrayList<MicroEnergyBean>();
        adapager = new MicroEnergyAdapager(this);
        for (int i = 0; i <= 5; i++) {
            beans_list.add(new MicroEnergyBean("", "123", "456", "789", "123"));
        }
        adapager.setList_micro(beans_list);
        list_item_micro_energy.setAdapter(adapager);
        adapager.notifyDataSetChanged();
    }
    @Override
    public void setListener() {
        micro_setting.setOnClickListener(this);
        btn_add.setOnClickListener(this);
    }
    @Override
    public void onAfterInit() {
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_add:
                start_Activity(new Intent(MicroEnergyActivity.this,AddAccountNumberActivity.class));
                break;
            case R.id.micro_setting:
                start_Activity(new Intent(MicroEnergyActivity.this,LoveSettingActivity.class));
                break;

        }
    }
}
